<template>
  <div>
    <category>
      <h1>默认{{ arr }}</h1>
    </category>
    <category>
      <template #header1> <h1>默认1</h1></template>
      <template #header2> <h1>默认2</h1></template>
    </category>

    <hr />
    <games ref="refgames">
      <template #default="user"> {{ user }} </template>
    </games>
  </div>
</template>

<script setup>
import category from "./category.vue";
import games from "./games.vue";
import { ref,onMounted } from "vue";

let arr = ref([1, 2]);
let refgames=ref()
onMounted(() => {
  console.log(refgames.value.user); // 此时 refgames.value 已经是子组件的实例
  refgames.value.user=2
});

</script>

<style lang="scss" scoped></style>
